// Description: Sample of using TEConnection object
// from java script.
// This script connects to ftp server changes the remote
// folder and downloads a file from it.
// Created: February 7, 2001
// Copyright (c) 2000 GlobalSCAPE, Inc.
// The copyright to the computer program(s) herein
// is the property of GlobalSCAPE, Inc.
// The program(s) may be used and/or copied only with
// the written permission of GlobalSCAPE, Inc.
// or in accordance with the terms and conditions
// stipulated in the agreement/contract under which
// the program(s) have been supplied.
//
//Create TEConnection object
var TEConnection = WScript.CreateObject("CuteFTPPro.TEConnection")
//Create standard Shell object
var Shell = WScript.CreateObject("WScript.Shell")
//Specify connection properties
TEConnection.Protocol = "FTP"
TEConnection.Host = "kyle.globalscape.com"
TEConnection.Login = "anonymous"
TEConnection.UseProxy = "BOTH"
TEConnection.RemoteFolder = "/Pub/CuteZip"
//Get name of desktop folder
strDesktop = Shell.SpecialFolders("Desktop")
TEConnection.Localfolder = strDesktop
//Display prompt
nUserChoise = Shell.Popup("Script will connect to the ftp server and download an exe file to the desktop folder.", 0, "CuteFTP Pro Connection Sample Script", 1)
//Quit if user clicked "Cancel"
if (nUserChoise == 2)
{
}
else if ( !TEConnection.RemoteExists("cutezip.exe"))
{
//Alert the user that the file requested does not exist on the server.
Shell.Popup("Remote file does not exist")
}
else
{
//Initiate download
Shell.popup("File Transfer will be started.\nCheck your CuteFTP pro Transfer Engine to check the download status.")